package com.pi.smart.wxmini.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.pi.base.dto.result.AppResult;
import com.pi.http.base.controller.BaseController;
import com.pi.uc.service.UcUserFollowService;
import com.pi.uc.vo.follow.UserFollowSketchVO;

@RequestMapping("/fellow")
@RestController
public class SmartFollowController extends BaseController{
  @Autowired
  private UcUserFollowService userFollowService;
  
  @PostMapping("follow")
  public AppResult follow(Long followUser, Boolean follow){
    userFollowService.smartfollow(getLoginUserId(), followUser, follow);
    return AppResult.OK;
  }
  
  @PostMapping("unfollow")
  public AppResult unfollow(Long followUser){
    userFollowService.unFollow(getLoginUserId(), followUser);
    return AppResult.OK;
  }
  
  @RequestMapping("list")
  public AppResult list(){
    UserFollowSketchVO sketch = userFollowService.queryUserFollowSketch(getLoginUserId());
    return AppResult.newSuccessResult(sketch);
  }
}
